﻿#include <QCoreApplication>
#include <QtNetwork>
#include <QHostInfo>
#include <FileTransferServer.h>
#include <QDebug>
#include "catnetwork.h"
#include "CatThreadPool.h"


int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    CatNetWork network;
    QObject::connect(&network, &CatNetWork::LookupHost, &network, [=](QString host){
        qDebug() << "Host: " << host;
    });
    QObject::connect(&network, &CatNetWork::update_NetWorkIpv4, &network, [=](QList<QString> list){
        qDebug() << "Ipv4: " << list;
    });
    QObject::connect(&network, &CatNetWork::update_NetWorkIpv6, &network, [=](QList<QString> list){
        qDebug() << "Ipv6: " << list;
    });
    network.lookupHost("www.graycatya.com");

    qDebug() << network.GetNetWorkHardware(network.GetAllIpaddressIpv4()[1], CatNetWork::V4);
    qDebug() << network.GetNetWorkBroadcast(network.GetAllIpaddressIpv4()[1], CatNetWork::V4);
    qDebug() << network.GetNetWorkNetMask(network.GetAllIpaddressIpv4()[1], CatNetWork::V4);

    network.Update_NetworkInterface();

    FileTransferServer server;
    server.Listen(QHostAddress("192.168.1.180"), 8888);





    return a.exec();
}
